/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.ipti.br.tag.bo;

import org.ipti.br.tag.dao.ActorFacade;
import org.ipti.br.tag.entity.Actor;
import org.ipti.br.tag.entity.ActorSchedule;
import org.ipti.br.tag.entity.Discipline;
import org.ipti.br.tag.entity.Person;
import org.ipti.br.tag.entity.Personage;
import org.ipti.br.tag.entity.Unity;
import org.ipti.br.tag.entity.UnitySchedule;
import org.ipti.br.tag.entity.enums.PersonageType;
import org.ipti.br.tag.entity.enums.Reference;
import java.io.Serializable;
import java.util.Calendar;
import java.util.List;
import javax.ejb.Stateless;
import javax.inject.Inject;
import org.ipti.br.tag.entity.Performance;

/**
 *
 * @author israel
 */
@Stateless
public class ActorBO implements Serializable {

    @Inject
    private ActorFacade actorDAO;

    public ActorFacade getActorDAO() {
        return actorDAO;
    }

    public void create(Actor actor) {
        getActorDAO().create(actor);
    }

    public void edit(Actor actor) {
        getActorDAO().edit(actor);
    }

    public void remove(Actor actor) {
        getActorDAO().remove(actor);
    }

    public Actor find(Object id) {
        return getActorDAO().find(id);
    }

    public Actor find(Actor actor) {
        return getActorDAO().findByFields(actor.getPerson(), actor.getPersonage(), actor.getUnity());
    }
    
    public Actor find(Person person, Personage personage, Unity unity) {
        return getActorDAO().findByFields(person, personage, unity);
    }

    public List<Actor> findAll() {
        return getActorDAO().findAll();
    }
    
    public List<Actor> actorActivatedPerPerson(Long personID) {
        return getActorDAO().actorActivatedPerPerson(personID);
    }

    public List<Actor> actorsPerPerson(Long personID) {
        return getActorDAO().actorsPerPerson(personID);
    }

    public List<Actor> actorActivatedPerUnity(Long unityID) {
        return getActorDAO().actorActivatedPerUnity(unityID);
    }

    public List<Actor> actorsPerUnity(Long unityID) {
        return getActorDAO().actorsPerUnity(unityID);
    }

    public List<Actor> actorsPerUnityPersonage(Long unityID, Long personageID) {
        return getActorDAO().actorsPerUnityPersonage(unityID, personageID);
    }

    public List<Actor> searchActorActivatedPerPersonPersonage(Long personID, Long personageID) {
        return getActorDAO().searchActorActivatedPerPersonPersonage(personID, personageID);
    }

    public boolean activatedActorForPersonExist(Long personID, Long personageID) {
        return (searchActorActivatedPerPersonPersonage(personID, personageID).size() > 0);
    }

    public List<Actor> searchActorActivatedPerPersonage(Long personageID) {
        return getActorDAO().searchActorActivatedPerPersonage(personageID);
    }

    public List<Actor> searchActorActivatedPerUnityPersonage(Long unityID, Long personageID) {
        return getActorDAO().searchActorActivatedPerUnityPersonage(unityID, personageID);
    }

    public List<Actor> searchActorPerUnityPersonage(Long unityID, Long personageID) {
        return getActorDAO().searchActorPerUnityPersonage(unityID, personageID);
    }

    public List<Actor> modifiedActorBetweenDate(Calendar initialDate, Calendar finalDate, Long serialNumber) {
        return getActorDAO().modifiedActorBetweenDate(initialDate, finalDate, serialNumber);
    }
    
    public List<Actor> searchActorActivatedPerPersonageUnityName(String humanName, Long unityID, Long personageID) {
        return getActorDAO().searchActorActivatedPerPersonageUnityName(humanName, unityID, personageID);
    }
    
    public List<Actor> searchActorActivatedPerPersonageUnitiesName(String humanName, List<Long> unities, Long personageID) {
        return getActorDAO().searchActorActivatedPerPersonageUnitiesName(humanName, unities, personageID);
    }
    
    public List<Actor> searchActorActivatedPerPersonageUnities(List<Long> unities, Long personageID) {
        return getActorDAO().searchActorActivatedPerPersonageUnities(unities, personageID);
    }
    
    public List<Actor> searchActorActivatedPerUnitiesMatriculated(List<Long> unities) {
        return getActorDAO().searchActorActivatedPerUnitiesMatriculated(unities);
    }
    
    public List<Actor> searchActorPerUnitiesMatriculated(Unity unity) {
        return getActorDAO().list(unity, null, PersonageType.MATRICULATED);
    }
    
    public List<Actor> searchActorPerUnitiesAllocated(Unity unity,Discipline discipline) {
        return getActorDAO().list(unity, discipline, PersonageType.ALLOCATED);
    }
    
    public void removePerformances(Actor actor){
        getActorDAO().removePerformances(actor);
    }
    
}
